package com.lujianfei.tiananyungu

import android.bluetooth.BluetoothAdapter
import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity

class TestActivity: ComponentActivity() {

    companion object {
        private val REQUEST_ENABLE_BT = 100
    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
    }

    private fun openBluetoothSettings() {
        val intent = Intent("android.settings.BLUETOOTH_SETTINGS")
        startActivityForResult(intent, REQUEST_ENABLE_BT)
    }

    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
        super.onActivityResult(requestCode, resultCode, data)
        if (requestCode == REQUEST_ENABLE_BT) {
            if (resultCode == RESULT_OK) {
                // Bluetooth is enabled
            } else {
                // Bluetooth is not enabled
            }
        }
    }
}